//
//  TwoHeaderView.m
//  Ai
//
//  Created by 杜超男 on 2019/3/20.
//  Copyright © 2019年 杜超男. All rights reserved.
//

#import "TwoHeaderView.h"

@implementation TwoHeaderView
// 重写初始化方法
- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        //rgba(103/255.0, 194/255.0, 86/255.0, 1)
        self.backgroundColor = [UIColor colorWithRed:103/255.0 green:194/255.0 blue:86/255.0 alpha:1];
        stateView = [[UIImageView alloc]initWithFrame:CGRectMake(6, 6, 17, 17)];
        //        stateView.image = [UIImage imageNamed:@"close"];
        //        stateView.image = [UIImage imageNamed:@"1"];
        
        [self addSubview:stateView];
        
        groupNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 18, 150, 15)];
        groupNameLabel.textColor = [UIColor whiteColor];
        groupNameLabel.backgroundColor = [UIColor clearColor];
        
        [self addSubview:groupNameLabel];
    }
    return self;
}
// 重写
-(void)setGroupName:(NSString *)theName{
    
    //    _groupName = [theName copy];
    _groupName = theName;
    groupNameLabel.text = _groupName;
}

-(void)setOpen:(BOOL)theOpen
{
    _open = theOpen;
    
    if (_open) {
        stateView.image = [UIImage imageNamed:@"1"];
    }else {
        stateView.image = [UIImage imageNamed:@"3"];
    }
}


@end

